import { DataRPermits } from './dataRPermits';
import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
@Define.Table({ TableName: "dataregister" })
export class DataRegister extends EntityObjectType<DataRegister>{
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    objectType: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    objectId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    dataType: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT,
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT,
    })
    updateTime: number;

    /**
     * 项目参与人列表
     *
     * @type {string}
     * @memberof DataRegister
     */
    @Define.Column({
        DataType: Define.DataType.JSON,
    })
    userIds: string;

    @Define.Column({
        DataType: Define.DataType.JSON,
    })
    data: any;

    /**
     * 操作人
     *
     * @type {string}
     * @memberof DataRegister
     */
    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    operatorId: string;

    /**
     * 提交时间
     *
     * @type {number} 
     * @memberof DataRegister
     */
    @Define.Column({
        DataType: Define.DataType.BIGINT,
    })
    operatorTime: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    orgId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    parentDataRegisterId: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT,
    })
    version: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
    })
    status: string;

    datarPermits: DataRPermits[] = [];
}

export const DataRegisterDataType = {
    // 流程单据
    WorkflowOrder: 'workflowOrder',
    Purchaser: 'purchaser',
}

export const DataRegisterStatus = {
    Suspend: 'suspend', // 暂停
    Closed: 'closed',  // 终止
    Complete: 'complete' //项目完成
}

